package com.helloandroid.dialogs

import android.content.Context
import android.view.animation.Animation
import android.view.animation.ScaleAnimation
import android.widget.Button
import android.widget.ImageView
import com.helloandroid.AppUtil
import com.helloandroid.MyApplication
import com.helloandroid.R
import com.helloandroid.base.BaseDialog

class BigAwardDialog(ctx:Context): BaseDialog(ctx) {

    lateinit var btnOpen:Button

    var openCallback:(()->Unit)? = null

    override fun getContentViewResId(): Int = R.layout.dialog_big_award

    override fun initView() {
        btnOpen = findViewById(R.id.btnOpen)

        btnOpen.setOnClickListener{
            openCallback?.invoke()
            cancel()
        }

        findBtn(R.id.btnClose).setOnClickListener {
            cancel()
        }

        // 来个动画,让 btnOpen 动起来
        val scale1 = ScaleAnimation(
                0.8f,
                1f,
                0.8f,
                1f,
        Animation.RELATIVE_TO_SELF,0.5f,
        Animation.RELATIVE_TO_SELF,0.5f)
        scale1.duration = 1000
        scale1.repeatCount = -1
        scale1.repeatMode = Animation.REVERSE
        btnOpen.startAnimation(scale1)
    }

    override fun initData() {
    }
}